﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Store Manager/SM_panel.master" AutoEventWireup="true" CodeFile="SM_Stock.aspx.cs" Inherits="Store_Manager_SM_Stock" %>

<%@ Register assembly="DevExpress.Web.ASPxGridView.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v10.2, Version=10.2.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" Runat="Server">
    <dx:ASPxGridView ID="ASPxGridView1" runat="server" AutoGenerateColumns="False" 
        ClientIDMode="AutoID" CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
        CssPostfix="BlackGlass" DataSourceID="SqlDataSource1" KeyFieldName="Sto_ID" 
        Width="100%">
        <Columns>
            <dx:GridViewCommandColumn VisibleIndex="0">
                <EditButton Visible="True">
                </EditButton>
                   </dx:GridViewCommandColumn>
                   <dx:GridViewCommandColumn VisibleIndex="0">
                <NewButton Visible="True">
                </NewButton>
                   </dx:GridViewCommandColumn>
                   
            <dx:GridViewDataTextColumn FieldName="Sto_ID" 
                ReadOnly="True" VisibleIndex="0" Caption="Stock ID">
                <EditFormSettings Visible="False" />
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataComboBoxColumn Caption="Item" FieldName="Pro_Name" 
                ReadOnly="True" VisibleIndex="1">
                <PropertiesComboBox TextField="Pro_Name" ValueField="Pro_Name" EnableSynchronization="True"
                    IncrementalFilteringMode="StartsWith" DataSourceID="SqlDataSource2" >
               
                </PropertiesComboBox>
            </dx:GridViewDataComboBoxColumn>
            <dx:GridViewDataTextColumn Caption="Physical Quantity" FieldName="Qty_in_stock" 
                VisibleIndex="2" ReadOnly="True">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="Reoder level" FieldName="Re_Order_Level" 
                VisibleIndex="3">
            </dx:GridViewDataTextColumn>
            <dx:GridViewDataTextColumn Caption="Reorder quantity" FieldName="Re_Order_qty" 
                VisibleIndex="4">
            </dx:GridViewDataTextColumn>
        </Columns>
        <SettingsBehavior ConfirmDelete="True" />
        <SettingsPager PageSize="25">
        </SettingsPager>
        <Settings ShowFilterRow="True" />
        <Images SpriteCssFilePath="~/App_Themes/BlackGlass/{0}/sprite.css">
            <LoadingPanelOnStatusBar Url="~/App_Themes/BlackGlass/GridView/gvLoadingOnStatusBar.gif">
            </LoadingPanelOnStatusBar>
            <LoadingPanel Url="~/App_Themes/BlackGlass/GridView/Loading.gif">
            </LoadingPanel>
        </Images>
        <ImagesFilterControl>
            <LoadingPanel Url="~/App_Themes/BlackGlass/Editors/Loading.gif">
            </LoadingPanel>
        </ImagesFilterControl>
        <Styles CssFilePath="~/App_Themes/BlackGlass/{0}/styles.css" 
            CssPostfix="BlackGlass">
            <Header ImageSpacing="5px" SortingImageSpacing="5px">
            </Header>
        </Styles>
        <StylesEditors>
            <CalendarHeader Spacing="1px">
            </CalendarHeader>
            <ProgressBar Height="25px">
            </ProgressBar>
        </StylesEditors>
    </dx:ASPxGridView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
        DeleteCommand="DELETE FROM [Tbl_Stock] WHERE [Sto_ID] = @Sto_ID AND [Pro_Name] = @Pro_Name" 
        InsertCommand="INSERT INTO [Tbl_Stock] ([Pro_Name], [Qty_in_stock], [Re_Order_Level], [Re_Order_qty]) VALUES (@Pro_Name, @Qty_in_stock, @Re_Order_Level, @Re_Order_qty)" 
        SelectCommand="SELECT [Sto_ID], [Pro_Name], [Qty_in_stock], [Re_Order_Level], [Re_Order_qty] FROM [Tbl_Stock]" 
        
        
        UpdateCommand="UPDATE [Tbl_Stock] SET [Qty_in_stock] = @Qty_in_stock, [Re_Order_Level] = @Re_Order_Level, [Re_Order_qty] = @Re_Order_qty WHERE [Sto_ID] = @Sto_ID AND [Pro_Name] = @Pro_Name">
        <DeleteParameters>
            <asp:Parameter Name="Sto_ID" Type="Int32" />
            <asp:Parameter Name="Pro_Name" Type="String" />
        </DeleteParameters>
        <InsertParameters>
            <asp:Parameter Name="Pro_Name" Type="String" />
            <asp:Parameter Name="Qty_in_stock" Type="Decimal" />
            <asp:Parameter Name="Re_Order_Level" Type="Decimal" />
            <asp:Parameter Name="Re_Order_qty" Type="Decimal" />
        </InsertParameters>
        <UpdateParameters>
            <asp:Parameter Name="Qty_in_stock" Type="Decimal" />
            <asp:Parameter Name="Re_Order_Level" Type="Decimal" />
            <asp:Parameter Name="Re_Order_qty" Type="Decimal" />
            <asp:Parameter Name="Sto_ID" Type="Int32" />
            <asp:Parameter Name="Pro_Name" Type="String" />
        </UpdateParameters>
    </asp:SqlDataSource>

     <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:BestlifeDBConnectionString %>" 
       
        SelectCommand="SELECT Pro_Name FROM Tbl_Product" >
       
       
    </asp:SqlDataSource>
</asp:Content>

